package team.mutong.taxi.test;

import java.io.DataOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import team.mutong.taxi.domain.DtwFeature;
import team.mutong.taxi.domain.GPSPoint;
import team.mutong.taxi.jdbc.DataBase;
import team.mutong.taxi.utils.ChangeType;
import team.mutong.taxi.utils.EuclideanMetric;

/** 
 * @author TomWang
 * @email wanghuochen@outlook.com
 * @date 2016年5月29日 下午1:56:11 
 * @version 1.0
 */
public class Report {

	public static void main(String[] args) throws IOException {
		DataBase.connectDB();
		List<DtwFeature> DtwList = DataBase.getDTWresult("T114");
		DataOutputStream out = new DataOutputStream(new FileOutputStream("F:/result.txt"));
		OutputStreamWriter osw = new OutputStreamWriter(out, "UTF-8");
		for (DtwFeature temp: DtwList) {
			Map<String, Object> data = temp.getData();
			String Road = ChangeType.blobChangetoString((byte[]) data.get("POLYLINE"));
			List<GPSPoint> testSetGpsPoint = ChangeType.changeToObject(Road);
			String TripId = (String) data.get("TRIP_ID");
			osw.write("TRIP:"+TripId+",GPS坐标结果:");
			osw.write(testSetGpsPoint.toString());
			osw.write("\r\n");
			osw.flush();
		}
		out.close();
		DataBase.closeDB();
	}
}